Data Exploration with the tidyverse

Resource and basis: https://r4ds.had.co.nz/transform.html

Data Preparation

  • Transforming: filtering, summarising, groupwise calculations
  • Tidying: data into appropriate formats
  • Merging: linking different data sets together

The tidyverse

Install the package

#this does not run
install.packages("tidyverse")
library(tidyverse)

Load the package

#this runs
library(tidyverse)
library(dplyr)

Gapminder Dataset

gap <- read.csv("data/gapminder-FiveYearData.csv", stringsAsFactors = TRUE)
head(gap)
##       country year      pop continent lifeExp gdpPercap
## 1 Afghanistan 1952  8425333      Asia  28.801  779.4453
## 2 Afghanistan 1957  9240934      Asia  30.332  820.8530
## 3 Afghanistan 1962 10267083      Asia  31.997  853.1007
## 4 Afghanistan 1967 11537966      Asia  34.020  836.1971
## 5 Afghanistan 1972 13079460      Asia  36.088  739.9811
## 6 Afghanistan 1977 14880372      Asia  38.438  786.1134

dplyr?

  1. select(): pick variables by their names
  2. filter(): pick observations by their values
  3. group_by(): change scope of the dataset
  4. summarize(): collapse many values into a single summary
  5. mutate(): create new variables as functions of existing variables
  6. arrange(): re-order rows.

Functions take arguments:

function(argument1, argument2, argument3, …)

First argument: the data Next arguments: options Ouput of a dplyr function is a new data frame

dataframe –> function –> dataframe

dplyr Functions

Select Columns with select

year_country_gdp <- select(gap, year, country, gdpPercap)

head(year_country_gdp)
##   year     country gdpPercap
## 1 1952 Afghanistan  779.4453
## 2 1957 Afghanistan  820.8530
## 3 1962 Afghanistan  853.1007
## 4 1967 Afghanistan  836.1971
## 5 1972 Afghanistan  739.9811
## 6 1977 Afghanistan  786.1134

The Pipe

# NOT run
cupcakes <- bake(pour(mix(ingredients)))
## NOT run
batter <- mix(ingredients)
muffin_tin <- pour(batter)
cupcakes <- bake(muffin_tin)
## NOT run
cupcakes <- ingredients %>% 
  mix() %>% 
  pour() %>% 
  bake()

select & Pipe (%>%)

#simple pipe
gap %>% 
  select(year, country, gdpPercap)
##      year                  country   gdpPercap
## 1    1952              Afghanistan    779.4453
## 2    1957              Afghanistan    820.8530
## 3    1962              Afghanistan    853.1007
## 4    1967              Afghanistan    836.1971
## 5    1972              Afghanistan    739.9811
## 6    1977              Afghanistan    786.1134
## 7    1982              Afghanistan    978.0114
## 8    1987              Afghanistan    852.3959
## 9    1992              Afghanistan    649.3414
## 10   1997              Afghanistan    635.3414
## 11   2002              Afghanistan    726.7341
## 12   2007              Afghanistan    974.5803
## 13   1952                  Albania   1601.0561
## 14   1957                  Albania   1942.2842
## 15   1962                  Albania   2312.8890
## 16   1967                  Albania   2760.1969
## 17   1972                  Albania   3313.4222
## 18   1977                  Albania   3533.0039
## 19   1982                  Albania   3630.8807
## 20   1987                  Albania   3738.9327
## 21   1992                  Albania   2497.4379
## 22   1997                  Albania   3193.0546
## 23   2002                  Albania   4604.2117
## 24   2007                  Albania   5937.0295
## 25   1952                  Algeria   2449.0082
## 26   1957                  Algeria   3013.9760
## 27   1962                  Algeria   2550.8169
## 28   1967                  Algeria   3246.9918
## 29   1972                  Algeria   4182.6638
## 30   1977                  Algeria   4910.4168
## 31   1982                  Algeria   5745.1602
## 32   1987                  Algeria   5681.3585
## 33   1992                  Algeria   5023.2166
## 34   1997                  Algeria   4797.2951
## 35   2002                  Algeria   5288.0404
## 36   2007                  Algeria   6223.3675
## 37   1952                   Angola   3520.6103
## 38   1957                   Angola   3827.9405
## 39   1962                   Angola   4269.2767
## 40   1967                   Angola   5522.7764
## 41   1972                   Angola   5473.2880
## 42   1977                   Angola   3008.6474
## 43   1982                   Angola   2756.9537
## 44   1987                   Angola   2430.2083
## 45   1992                   Angola   2627.8457
## 46   1997                   Angola   2277.1409
## 47   2002                   Angola   2773.2873
## 48   2007                   Angola   4797.2313
## 49   1952                Argentina   5911.3151
## 50   1957                Argentina   6856.8562
## 51   1962                Argentina   7133.1660
## 52   1967                Argentina   8052.9530
## 53   1972                Argentina   9443.0385
## 54   1977                Argentina  10079.0267
## 55   1982                Argentina   8997.8974
## 56   1987                Argentina   9139.6714
## 57   1992                Argentina   9308.4187
## 58   1997                Argentina  10967.2820
## 59   2002                Argentina   8797.6407
## 60   2007                Argentina  12779.3796
## 61   1952                Australia  10039.5956
## 62   1957                Australia  10949.6496
## 63   1962                Australia  12217.2269
## 64   1967                Australia  14526.1246
## 65   1972                Australia  16788.6295
## 66   1977                Australia  18334.1975
## 67   1982                Australia  19477.0093
## 68   1987                Australia  21888.8890
## 69   1992                Australia  23424.7668
## 70   1997                Australia  26997.9366
## 71   2002                Australia  30687.7547
## 72   2007                Australia  34435.3674
## 73   1952                  Austria   6137.0765
## 74   1957                  Austria   8842.5980
## 75   1962                  Austria  10750.7211
## 76   1967                  Austria  12834.6024
## 77   1972                  Austria  16661.6256
## 78   1977                  Austria  19749.4223
## 79   1982                  Austria  21597.0836
## 80   1987                  Austria  23687.8261
## 81   1992                  Austria  27042.0187
## 82   1997                  Austria  29095.9207
## 83   2002                  Austria  32417.6077
## 84   2007                  Austria  36126.4927
## 85   1952                  Bahrain   9867.0848
## 86   1957                  Bahrain  11635.7995
## 87   1962                  Bahrain  12753.2751
## 88   1967                  Bahrain  14804.6727
## 89   1972                  Bahrain  18268.6584
## 90   1977                  Bahrain  19340.1020
## 91   1982                  Bahrain  19211.1473
## 92   1987                  Bahrain  18524.0241
## 93   1992                  Bahrain  19035.5792
## 94   1997                  Bahrain  20292.0168
## 95   2002                  Bahrain  23403.5593
## 96   2007                  Bahrain  29796.0483
## 97   1952               Bangladesh    684.2442
## 98   1957               Bangladesh    661.6375
## 99   1962               Bangladesh    686.3416
## 100  1967               Bangladesh    721.1861
## 101  1972               Bangladesh    630.2336
## 102  1977               Bangladesh    659.8772
## 103  1982               Bangladesh    676.9819
## 104  1987               Bangladesh    751.9794
## 105  1992               Bangladesh    837.8102
## 106  1997               Bangladesh    972.7700
## 107  2002               Bangladesh   1136.3904
## 108  2007               Bangladesh   1391.2538
## 109  1952                  Belgium   8343.1051
## 110  1957                  Belgium   9714.9606
## 111  1962                  Belgium  10991.2068
## 112  1967                  Belgium  13149.0412
## 113  1972                  Belgium  16672.1436
## 114  1977                  Belgium  19117.9745
## 115  1982                  Belgium  20979.8459
## 116  1987                  Belgium  22525.5631
## 117  1992                  Belgium  25575.5707
## 118  1997                  Belgium  27561.1966
## 119  2002                  Belgium  30485.8838
## 120  2007                  Belgium  33692.6051
## 121  1952                    Benin   1062.7522
## 122  1957                    Benin    959.6011
## 123  1962                    Benin    949.4991
## 124  1967                    Benin   1035.8314
## 125  1972                    Benin   1085.7969
## 126  1977                    Benin   1029.1613
## 127  1982                    Benin   1277.8976
## 128  1987                    Benin   1225.8560
## 129  1992                    Benin   1191.2077
## 130  1997                    Benin   1232.9753
## 131  2002                    Benin   1372.8779
## 132  2007                    Benin   1441.2849
## 133  1952                  Bolivia   2677.3263
## 134  1957                  Bolivia   2127.6863
## 135  1962                  Bolivia   2180.9725
## 136  1967                  Bolivia   2586.8861
## 137  1972                  Bolivia   2980.3313
## 138  1977                  Bolivia   3548.0978
## 139  1982                  Bolivia   3156.5105
## 140  1987                  Bolivia   2753.6915
## 141  1992                  Bolivia   2961.6997
## 142  1997                  Bolivia   3326.1432
## 143  2002                  Bolivia   3413.2627
## 144  2007                  Bolivia   3822.1371
## 145  1952   Bosnia and Herzegovina    973.5332
## 146  1957   Bosnia and Herzegovina   1353.9892
## 147  1962   Bosnia and Herzegovina   1709.6837
## 148  1967   Bosnia and Herzegovina   2172.3524
## 149  1972   Bosnia and Herzegovina   2860.1698
## 150  1977   Bosnia and Herzegovina   3528.4813
## 151  1982   Bosnia and Herzegovina   4126.6132
## 152  1987   Bosnia and Herzegovina   4314.1148
## 153  1992   Bosnia and Herzegovina   2546.7814
## 154  1997   Bosnia and Herzegovina   4766.3559
## 155  2002   Bosnia and Herzegovina   6018.9752
## 156  2007   Bosnia and Herzegovina   7446.2988
## 157  1952                 Botswana    851.2411
## 158  1957                 Botswana    918.2325
## 159  1962                 Botswana    983.6540
## 160  1967                 Botswana   1214.7093
## 161  1972                 Botswana   2263.6111
## 162  1977                 Botswana   3214.8578
## 163  1982                 Botswana   4551.1421
## 164  1987                 Botswana   6205.8839
## 165  1992                 Botswana   7954.1116
## 166  1997                 Botswana   8647.1423
## 167  2002                 Botswana  11003.6051
## 168  2007                 Botswana  12569.8518
## 169  1952                   Brazil   2108.9444
## 170  1957                   Brazil   2487.3660
## 171  1962                   Brazil   3336.5858
## 172  1967                   Brazil   3429.8644
## 173  1972                   Brazil   4985.7115
## 174  1977                   Brazil   6660.1187
## 175  1982                   Brazil   7030.8359
## 176  1987                   Brazil   7807.0958
## 177  1992                   Brazil   6950.2830
## 178  1997                   Brazil   7957.9808
## 179  2002                   Brazil   8131.2128
## 180  2007                   Brazil   9065.8008
## 181  1952                 Bulgaria   2444.2866
## 182  1957                 Bulgaria   3008.6707
## 183  1962                 Bulgaria   4254.3378
## 184  1967                 Bulgaria   5577.0028
## 185  1972                 Bulgaria   6597.4944
## 186  1977                 Bulgaria   7612.2404
## 187  1982                 Bulgaria   8224.1916
## 188  1987                 Bulgaria   8239.8548
## 189  1992                 Bulgaria   6302.6234
## 190  1997                 Bulgaria   5970.3888
## 191  2002                 Bulgaria   7696.7777
## 192  2007                 Bulgaria  10680.7928
## 193  1952             Burkina Faso    543.2552
## 194  1957             Burkina Faso    617.1835
## 195  1962             Burkina Faso    722.5120
## 196  1967             Burkina Faso    794.8266
## 197  1972             Burkina Faso    854.7360
## 198  1977             Burkina Faso    743.3870
## 199  1982             Burkina Faso    807.1986
## 200  1987             Burkina Faso    912.0631
## 201  1992             Burkina Faso    931.7528
## 202  1997             Burkina Faso    946.2950
## 203  2002             Burkina Faso   1037.6452
## 204  2007             Burkina Faso   1217.0330
## 205  1952                  Burundi    339.2965
## 206  1957                  Burundi    379.5646
## 207  1962                  Burundi    355.2032
## 208  1967                  Burundi    412.9775
## 209  1972                  Burundi    464.0995
## 210  1977                  Burundi    556.1033
## 211  1982                  Burundi    559.6032
## 212  1987                  Burundi    621.8188
## 213  1992                  Burundi    631.6999
## 214  1997                  Burundi    463.1151
## 215  2002                  Burundi    446.4035
## 216  2007                  Burundi    430.0707
## 217  1952                 Cambodia    368.4693
## 218  1957                 Cambodia    434.0383
## 219  1962                 Cambodia    496.9136
## 220  1967                 Cambodia    523.4323
## 221  1972                 Cambodia    421.6240
## 222  1977                 Cambodia    524.9722
## 223  1982                 Cambodia    624.4755
## 224  1987                 Cambodia    683.8956
## 225  1992                 Cambodia    682.3032
## 226  1997                 Cambodia    734.2852
## 227  2002                 Cambodia    896.2260
## 228  2007                 Cambodia   1713.7787
## 229  1952                 Cameroon   1172.6677
## 230  1957                 Cameroon   1313.0481
## 231  1962                 Cameroon   1399.6074
## 232  1967                 Cameroon   1508.4531
## 233  1972                 Cameroon   1684.1465
## 234  1977                 Cameroon   1783.4329
## 235  1982                 Cameroon   2367.9833
## 236  1987                 Cameroon   2602.6642
## 237  1992                 Cameroon   1793.1633
## 238  1997                 Cameroon   1694.3375
## 239  2002                 Cameroon   1934.0114
## 240  2007                 Cameroon   2042.0952
## 241  1952                   Canada  11367.1611
## 242  1957                   Canada  12489.9501
## 243  1962                   Canada  13462.4855
## 244  1967                   Canada  16076.5880
## 245  1972                   Canada  18970.5709
## 246  1977                   Canada  22090.8831
## 247  1982                   Canada  22898.7921
## 248  1987                   Canada  26626.5150
## 249  1992                   Canada  26342.8843
## 250  1997                   Canada  28954.9259
## 251  2002                   Canada  33328.9651
## 252  2007                   Canada  36319.2350
## 253  1952 Central African Republic   1071.3107
## 254  1957 Central African Republic   1190.8443
## 255  1962 Central African Republic   1193.0688
## 256  1967 Central African Republic   1136.0566
## 257  1972 Central African Republic   1070.0133
## 258  1977 Central African Republic   1109.3743
## 259  1982 Central African Republic    956.7530
## 260  1987 Central African Republic    844.8764
## 261  1992 Central African Republic    747.9055
## 262  1997 Central African Republic    740.5063
## 263  2002 Central African Republic    738.6906
## 264  2007 Central African Republic    706.0165
## 265  1952                     Chad   1178.6659
## 266  1957                     Chad   1308.4956
## 267  1962                     Chad   1389.8176
## 268  1967                     Chad   1196.8106
## 269  1972                     Chad   1104.1040
## 270  1977                     Chad   1133.9850
## 271  1982                     Chad    797.9081
## 272  1987                     Chad    952.3861
## 273  1992                     Chad   1058.0643
## 274  1997                     Chad   1004.9614
## 275  2002                     Chad   1156.1819
## 276  2007                     Chad   1704.0637
## 277  1952                    Chile   3939.9788
## 278  1957                    Chile   4315.6227
## 279  1962                    Chile   4519.0943
## 280  1967                    Chile   5106.6543
## 281  1972                    Chile   5494.0244
## 282  1977                    Chile   4756.7638
## 283  1982                    Chile   5095.6657
## 284  1987                    Chile   5547.0638
## 285  1992                    Chile   7596.1260
## 286  1997                    Chile  10118.0532
## 287  2002                    Chile  10778.7838
## 288  2007                    Chile  13171.6388
## 289  1952                    China    400.4486
## 290  1957                    China    575.9870
## 291  1962                    China    487.6740
## 292  1967                    China    612.7057
## 293  1972                    China    676.9001
## 294  1977                    China    741.2375
## 295  1982                    China    962.4214
## 296  1987                    China   1378.9040
## 297  1992                    China   1655.7842
## 298  1997                    China   2289.2341
## 299  2002                    China   3119.2809
## 300  2007                    China   4959.1149
## 301  1952                 Colombia   2144.1151
## 302  1957                 Colombia   2323.8056
## 303  1962                 Colombia   2492.3511
## 304  1967                 Colombia   2678.7298
## 305  1972                 Colombia   3264.6600
## 306  1977                 Colombia   3815.8079
## 307  1982                 Colombia   4397.5757
## 308  1987                 Colombia   4903.2191
## 309  1992                 Colombia   5444.6486
## 310  1997                 Colombia   6117.3617
## 311  2002                 Colombia   5755.2600
## 312  2007                 Colombia   7006.5804
## 313  1952                  Comoros   1102.9909
## 314  1957                  Comoros   1211.1485
## 315  1962                  Comoros   1406.6483
## 316  1967                  Comoros   1876.0296
## 317  1972                  Comoros   1937.5777
## 318  1977                  Comoros   1172.6030
## 319  1982                  Comoros   1267.1001
## 320  1987                  Comoros   1315.9808
## 321  1992                  Comoros   1246.9074
## 322  1997                  Comoros   1173.6182
## 323  2002                  Comoros   1075.8116
## 324  2007                  Comoros    986.1479
## 325  1952          Congo Dem. Rep.    780.5423
## 326  1957          Congo Dem. Rep.    905.8602
## 327  1962          Congo Dem. Rep.    896.3146
## 328  1967          Congo Dem. Rep.    861.5932
## 329  1972          Congo Dem. Rep.    904.8961
## 330  1977          Congo Dem. Rep.    795.7573
## 331  1982          Congo Dem. Rep.    673.7478
## 332  1987          Congo Dem. Rep.    672.7748
## 333  1992          Congo Dem. Rep.    457.7192
## 334  1997          Congo Dem. Rep.    312.1884
## 335  2002          Congo Dem. Rep.    241.1659
## 336  2007          Congo Dem. Rep.    277.5519
## 337  1952               Congo Rep.   2125.6214
## 338  1957               Congo Rep.   2315.0566
## 339  1962               Congo Rep.   2464.7832
## 340  1967               Congo Rep.   2677.9396
## 341  1972               Congo Rep.   3213.1527
## 342  1977               Congo Rep.   3259.1790
## 343  1982               Congo Rep.   4879.5075
## 344  1987               Congo Rep.   4201.1949
## 345  1992               Congo Rep.   4016.2395
## 346  1997               Congo Rep.   3484.1644
## 347  2002               Congo Rep.   3484.0620
## 348  2007               Congo Rep.   3632.5578
## 349  1952               Costa Rica   2627.0095
## 350  1957               Costa Rica   2990.0108
## 351  1962               Costa Rica   3460.9370
## 352  1967               Costa Rica   4161.7278
## 353  1972               Costa Rica   5118.1469
## 354  1977               Costa Rica   5926.8770
## 355  1982               Costa Rica   5262.7348
## 356  1987               Costa Rica   5629.9153
## 357  1992               Costa Rica   6160.4163
## 358  1997               Costa Rica   6677.0453
## 359  2002               Costa Rica   7723.4472
## 360  2007               Costa Rica   9645.0614
## 361  1952            Cote d'Ivoire   1388.5947
## 362  1957            Cote d'Ivoire   1500.8959
## 363  1962            Cote d'Ivoire   1728.8694
## 364  1967            Cote d'Ivoire   2052.0505
## 365  1972            Cote d'Ivoire   2378.2011
## 366  1977            Cote d'Ivoire   2517.7365
## 367  1982            Cote d'Ivoire   2602.7102
## 368  1987            Cote d'Ivoire   2156.9561
## 369  1992            Cote d'Ivoire   1648.0738
## 370  1997            Cote d'Ivoire   1786.2654
## 371  2002            Cote d'Ivoire   1648.8008
## 372  2007            Cote d'Ivoire   1544.7501
## 373  1952                  Croatia   3119.2365
## 374  1957                  Croatia   4338.2316
## 375  1962                  Croatia   5477.8900
## 376  1967                  Croatia   6960.2979
## 377  1972                  Croatia   9164.0901
## 378  1977                  Croatia  11305.3852
## 379  1982                  Croatia  13221.8218
## 380  1987                  Croatia  13822.5839
## 381  1992                  Croatia   8447.7949
## 382  1997                  Croatia   9875.6045
## 383  2002                  Croatia  11628.3890
## 384  2007                  Croatia  14619.2227
## 385  1952                     Cuba   5586.5388
## 386  1957                     Cuba   6092.1744
## 387  1962                     Cuba   5180.7559
## 388  1967                     Cuba   5690.2680
## 389  1972                     Cuba   5305.4453
## 390  1977                     Cuba   6380.4950
## 391  1982                     Cuba   7316.9181
## 392  1987                     Cuba   7532.9248
## 393  1992                     Cuba   5592.8440
## 394  1997                     Cuba   5431.9904
## 395  2002                     Cuba   6340.6467
## 396  2007                     Cuba   8948.1029
## 397  1952           Czech Republic   6876.1403
## 398  1957           Czech Republic   8256.3439
## 399  1962           Czech Republic  10136.8671
## 400  1967           Czech Republic  11399.4449
## 401  1972           Czech Republic  13108.4536
## 402  1977           Czech Republic  14800.1606
## 403  1982           Czech Republic  15377.2285
## 404  1987           Czech Republic  16310.4434
## 405  1992           Czech Republic  14297.0212
## 406  1997           Czech Republic  16048.5142
## 407  2002           Czech Republic  17596.2102
## 408  2007           Czech Republic  22833.3085
## 409  1952                  Denmark   9692.3852
## 410  1957                  Denmark  11099.6593
## 411  1962                  Denmark  13583.3135
## 412  1967                  Denmark  15937.2112
## 413  1972                  Denmark  18866.2072
## 414  1977                  Denmark  20422.9015
## 415  1982                  Denmark  21688.0405
## 416  1987                  Denmark  25116.1758
## 417  1992                  Denmark  26406.7399
## 418  1997                  Denmark  29804.3457
## 419  2002                  Denmark  32166.5001
## 420  2007                  Denmark  35278.4187
## 421  1952                 Djibouti   2669.5295
## 422  1957                 Djibouti   2864.9691
## 423  1962                 Djibouti   3020.9893
## 424  1967                 Djibouti   3020.0505
## 425  1972                 Djibouti   3694.2124
## 426  1977                 Djibouti   3081.7610
## 427  1982                 Djibouti   2879.4681
## 428  1987                 Djibouti   2880.1026
## 429  1992                 Djibouti   2377.1562
## 430  1997                 Djibouti   1895.0170
## 431  2002                 Djibouti   1908.2609
## 432  2007                 Djibouti   2082.4816
## 433  1952       Dominican Republic   1397.7171
## 434  1957       Dominican Republic   1544.4030
## 435  1962       Dominican Republic   1662.1374
## 436  1967       Dominican Republic   1653.7230
## 437  1972       Dominican Republic   2189.8745
## 438  1977       Dominican Republic   2681.9889
## 439  1982       Dominican Republic   2861.0924
## 440  1987       Dominican Republic   2899.8422
## 441  1992       Dominican Republic   3044.2142
## 442  1997       Dominican Republic   3614.1013
## 443  2002       Dominican Republic   4563.8082
## 444  2007       Dominican Republic   6025.3748
## 445  1952                  Ecuador   3522.1107
## 446  1957                  Ecuador   3780.5467
## 447  1962                  Ecuador   4086.1141
## 448  1967                  Ecuador   4579.0742
## 449  1972                  Ecuador   5280.9947
## 450  1977                  Ecuador   6679.6233
## 451  1982                  Ecuador   7213.7913
## 452  1987                  Ecuador   6481.7770
## 453  1992                  Ecuador   7103.7026
## 454  1997                  Ecuador   7429.4559
## 455  2002                  Ecuador   5773.0445
## 456  2007                  Ecuador   6873.2623
## 457  1952                    Egypt   1418.8224
## 458  1957                    Egypt   1458.9153
## 459  1962                    Egypt   1693.3359
## 460  1967                    Egypt   1814.8807
## 461  1972                    Egypt   2024.0081
## 462  1977                    Egypt   2785.4936
## 463  1982                    Egypt   3503.7296
## 464  1987                    Egypt   3885.4607
## 465  1992                    Egypt   3794.7552
## 466  1997                    Egypt   4173.1818
## 467  2002                    Egypt   4754.6044
## 468  2007                    Egypt   5581.1810
## 469  1952              El Salvador   3048.3029
## 470  1957              El Salvador   3421.5232
## 471  1962              El Salvador   3776.8036
## 472  1967              El Salvador   4358.5954
## 473  1972              El Salvador   4520.2460
## 474  1977              El Salvador   5138.9224
## 475  1982              El Salvador   4098.3442
## 476  1987              El Salvador   4140.4421
## 477  1992              El Salvador   4444.2317
## 478  1997              El Salvador   5154.8255
## 479  2002              El Salvador   5351.5687
## 480  2007              El Salvador   5728.3535
## 481  1952        Equatorial Guinea    375.6431
## 482  1957        Equatorial Guinea    426.0964
## 483  1962        Equatorial Guinea    582.8420
## 484  1967        Equatorial Guinea    915.5960
## 485  1972        Equatorial Guinea    672.4123
## 486  1977        Equatorial Guinea    958.5668
## 487  1982        Equatorial Guinea    927.8253
## 488  1987        Equatorial Guinea    966.8968
## 489  1992        Equatorial Guinea   1132.0550
## 490  1997        Equatorial Guinea   2814.4808
## 491  2002        Equatorial Guinea   7703.4959
## 492  2007        Equatorial Guinea  12154.0897
## 493  1952                  Eritrea    328.9406
## 494  1957                  Eritrea    344.1619
## 495  1962                  Eritrea    380.9958
## 496  1967                  Eritrea    468.7950
## 497  1972                  Eritrea    514.3242
## 498  1977                  Eritrea    505.7538
## 499  1982                  Eritrea    524.8758
## 500  1987                  Eritrea    521.1341
## 501  1992                  Eritrea    582.8585
## 502  1997                  Eritrea    913.4708
## 503  2002                  Eritrea    765.3500
## 504  2007                  Eritrea    641.3695
## 505  1952                 Ethiopia    362.1463
## 506  1957                 Ethiopia    378.9042
## 507  1962                 Ethiopia    419.4564
## 508  1967                 Ethiopia    516.1186
## 509  1972                 Ethiopia    566.2439
## 510  1977                 Ethiopia    556.8084
## 511  1982                 Ethiopia    577.8607
## 512  1987                 Ethiopia    573.7413
## 513  1992                 Ethiopia    421.3535
## 514  1997                 Ethiopia    515.8894
## 515  2002                 Ethiopia    530.0535
## 516  2007                 Ethiopia    690.8056
## 517  1952                  Finland   6424.5191
## 518  1957                  Finland   7545.4154
## 519  1962                  Finland   9371.8426
## 520  1967                  Finland  10921.6363
## 521  1972                  Finland  14358.8759
## 522  1977                  Finland  15605.4228
## 523  1982                  Finland  18533.1576
## 524  1987                  Finland  21141.0122
## 525  1992                  Finland  20647.1650
## 526  1997                  Finland  23723.9502
## 527  2002                  Finland  28204.5906
## 528  2007                  Finland  33207.0844
## 529  1952                   France   7029.8093
## 530  1957                   France   8662.8349
## 531  1962                   France  10560.4855
## 532  1967                   France  12999.9177
## 533  1972                   France  16107.1917
## 534  1977                   France  18292.6351
## 535  1982                   France  20293.8975
## 536  1987                   France  22066.4421
## 537  1992                   France  24703.7961
## 538  1997                   France  25889.7849
## 539  2002                   France  28926.0323
## 540  2007                   France  30470.0167
## 541  1952                    Gabon   4293.4765
## 542  1957                    Gabon   4976.1981
## 543  1962                    Gabon   6631.4592
## 544  1967                    Gabon   8358.7620
## 545  1972                    Gabon  11401.9484
## 546  1977                    Gabon  21745.5733
## 547  1982                    Gabon  15113.3619
## 548  1987                    Gabon  11864.4084
## 549  1992                    Gabon  13522.1575
## 550  1997                    Gabon  14722.8419
## 551  2002                    Gabon  12521.7139
## 552  2007                    Gabon  13206.4845
## 553  1952                   Gambia    485.2307
## 554  1957                   Gambia    520.9267
## 555  1962                   Gambia    599.6503
## 556  1967                   Gambia    734.7829
## 557  1972                   Gambia    756.0868
## 558  1977                   Gambia    884.7553
## 559  1982                   Gambia    835.8096
## 560  1987                   Gambia    611.6589
## 561  1992                   Gambia    665.6244
## 562  1997                   Gambia    653.7302
## 563  2002                   Gambia    660.5856
## 564  2007                   Gambia    752.7497
## 565  1952                  Germany   7144.1144
## 566  1957                  Germany  10187.8267
## 567  1962                  Germany  12902.4629
## 568  1967                  Germany  14745.6256
## 569  1972                  Germany  18016.1803
## 570  1977                  Germany  20512.9212
## 571  1982                  Germany  22031.5327
## 572  1987                  Germany  24639.1857
## 573  1992                  Germany  26505.3032
## 574  1997                  Germany  27788.8842
## 575  2002                  Germany  30035.8020
## 576  2007                  Germany  32170.3744
## 577  1952                    Ghana    911.2989
## 578  1957                    Ghana   1043.5615
## 579  1962                    Ghana   1190.0411
## 580  1967                    Ghana   1125.6972
## 581  1972                    Ghana   1178.2237
## 582  1977                    Ghana    993.2240
## 583  1982                    Ghana    876.0326
## 584  1987                    Ghana    847.0061
## 585  1992                    Ghana    925.0602
## 586  1997                    Ghana   1005.2458
## 587  2002                    Ghana   1111.9846
## 588  2007                    Ghana   1327.6089
## 589  1952                   Greece   3530.6901
## 590  1957                   Greece   4916.2999
## 591  1962                   Greece   6017.1907
## 592  1967                   Greece   8513.0970
## 593  1972                   Greece  12724.8296
## 594  1977                   Greece  14195.5243
## 595  1982                   Greece  15268.4209
## 596  1987                   Greece  16120.5284
## 597  1992                   Greece  17541.4963
## 598  1997                   Greece  18747.6981
## 599  2002                   Greece  22514.2548
## 600  2007                   Greece  27538.4119
## 601  1952                Guatemala   2428.2378
## 602  1957                Guatemala   2617.1560
## 603  1962                Guatemala   2750.3644
## 604  1967                Guatemala   3242.5311
## 605  1972                Guatemala   4031.4083
## 606  1977                Guatemala   4879.9927
## 607  1982                Guatemala   4820.4948
## 608  1987                Guatemala   4246.4860
## 609  1992                Guatemala   4439.4508
## 610  1997                Guatemala   4684.3138
## 611  2002                Guatemala   4858.3475
## 612  2007                Guatemala   5186.0500
## 613  1952                   Guinea    510.1965
## 614  1957                   Guinea    576.2670
## 615  1962                   Guinea    686.3737
## 616  1967                   Guinea    708.7595
## 617  1972                   Guinea    741.6662
## 618  1977                   Guinea    874.6859
## 619  1982                   Guinea    857.2504
## 620  1987                   Guinea    805.5725
## 621  1992                   Guinea    794.3484
## 622  1997                   Guinea    869.4498
## 623  2002                   Guinea    945.5836
## 624  2007                   Guinea    942.6542
## 625  1952            Guinea-Bissau    299.8503
## 626  1957            Guinea-Bissau    431.7905
## 627  1962            Guinea-Bissau    522.0344
## 628  1967            Guinea-Bissau    715.5806
## 629  1972            Guinea-Bissau    820.2246
## 630  1977            Guinea-Bissau    764.7260
## 631  1982            Guinea-Bissau    838.1240
## 632  1987            Guinea-Bissau    736.4154
## 633  1992            Guinea-Bissau    745.5399
## 634  1997            Guinea-Bissau    796.6645
## 635  2002            Guinea-Bissau    575.7047
## 636  2007            Guinea-Bissau    579.2317
## 637  1952                    Haiti   1840.3669
## 638  1957                    Haiti   1726.8879
## 639  1962                    Haiti   1796.5890
## 640  1967                    Haiti   1452.0577
## 641  1972                    Haiti   1654.4569
## 642  1977                    Haiti   1874.2989
## 643  1982                    Haiti   2011.1595
## 644  1987                    Haiti   1823.0160
## 645  1992                    Haiti   1456.3095
## 646  1997                    Haiti   1341.7269
## 647  2002                    Haiti   1270.3649
## 648  2007                    Haiti   1201.6372
## 649  1952                 Honduras   2194.9262
## 650  1957                 Honduras   2220.4877
## 651  1962                 Honduras   2291.1568
## 652  1967                 Honduras   2538.2694
## 653  1972                 Honduras   2529.8423
## 654  1977                 Honduras   3203.2081
## 655  1982                 Honduras   3121.7608
## 656  1987                 Honduras   3023.0967
## 657  1992                 Honduras   3081.6946
## 658  1997                 Honduras   3160.4549
## 659  2002                 Honduras   3099.7287
## 660  2007                 Honduras   3548.3308
## 661  1952          Hong Kong China   3054.4212
## 662  1957          Hong Kong China   3629.0765
## 663  1962          Hong Kong China   4692.6483
## 664  1967          Hong Kong China   6197.9628
## 665  1972          Hong Kong China   8315.9281
## 666  1977          Hong Kong China  11186.1413
## 667  1982          Hong Kong China  14560.5305
## 668  1987          Hong Kong China  20038.4727
## 669  1992          Hong Kong China  24757.6030
## 670  1997          Hong Kong China  28377.6322
## 671  2002          Hong Kong China  30209.0152
## 672  2007          Hong Kong China  39724.9787
## 673  1952                  Hungary   5263.6738
## 674  1957                  Hungary   6040.1800
## 675  1962                  Hungary   7550.3599
## 676  1967                  Hungary   9326.6447
## 677  1972                  Hungary  10168.6561
## 678  1977                  Hungary  11674.8374
## 679  1982                  Hungary  12545.9907
## 680  1987                  Hungary  12986.4800
## 681  1992                  Hungary  10535.6285
## 682  1997                  Hungary  11712.7768
## 683  2002                  Hungary  14843.9356
## 684  2007                  Hungary  18008.9444
## 685  1952                  Iceland   7267.6884
## 686  1957                  Iceland   9244.0014
## 687  1962                  Iceland  10350.1591
## 688  1967                  Iceland  13319.8957
## 689  1972                  Iceland  15798.0636
## 690  1977                  Iceland  19654.9625
## 691  1982                  Iceland  23269.6075
## 692  1987                  Iceland  26923.2063
## 693  1992                  Iceland  25144.3920
## 694  1997                  Iceland  28061.0997
## 695  2002                  Iceland  31163.2020
## 696  2007                  Iceland  36180.7892
## 697  1952                    India    546.5657
## 698  1957                    India    590.0620
## 699  1962                    India    658.3472
## 700  1967                    India    700.7706
## 701  1972                    India    724.0325
## 702  1977                    India    813.3373
## 703  1982                    India    855.7235
## 704  1987                    India    976.5127
## 705  1992                    India   1164.4068
## 706  1997                    India   1458.8174
## 707  2002                    India   1746.7695
## 708  2007                    India   2452.2104
## 709  1952                Indonesia    749.6817
## 710  1957                Indonesia    858.9003
## 711  1962                Indonesia    849.2898
## 712  1967                Indonesia    762.4318
## 713  1972                Indonesia   1111.1079
## 714  1977                Indonesia   1382.7021
## 715  1982                Indonesia   1516.8730
## 716  1987                Indonesia   1748.3570
## 717  1992                Indonesia   2383.1409
## 718  1997                Indonesia   3119.3356
## 719  2002                Indonesia   2873.9129
## 720  2007                Indonesia   3540.6516
## 721  1952                     Iran   3035.3260
## 722  1957                     Iran   3290.2576
## 723  1962                     Iran   4187.3298
## 724  1967                     Iran   5906.7318
## 725  1972                     Iran   9613.8186
## 726  1977                     Iran  11888.5951
## 727  1982                     Iran   7608.3346
## 728  1987                     Iran   6642.8814
## 729  1992                     Iran   7235.6532
## 730  1997                     Iran   8263.5903
## 731  2002                     Iran   9240.7620
## 732  2007                     Iran  11605.7145
## 733  1952                     Iraq   4129.7661
## 734  1957                     Iraq   6229.3336
## 735  1962                     Iraq   8341.7378
## 736  1967                     Iraq   8931.4598
## 737  1972                     Iraq   9576.0376
## 738  1977                     Iraq  14688.2351
## 739  1982                     Iraq  14517.9071
## 740  1987                     Iraq  11643.5727
## 741  1992                     Iraq   3745.6407
## 742  1997                     Iraq   3076.2398
## 743  2002                     Iraq   4390.7173
## 744  2007                     Iraq   4471.0619
## 745  1952                  Ireland   5210.2803
## 746  1957                  Ireland   5599.0779
## 747  1962                  Ireland   6631.5973
## 748  1967                  Ireland   7655.5690
## 749  1972                  Ireland   9530.7729
## 750  1977                  Ireland  11150.9811
## 751  1982                  Ireland  12618.3214
## 752  1987                  Ireland  13872.8665
## 753  1992                  Ireland  17558.8155
## 754  1997                  Ireland  24521.9471
## 755  2002                  Ireland  34077.0494
## 756  2007                  Ireland  40675.9964
## 757  1952                   Israel   4086.5221
## 758  1957                   Israel   5385.2785
## 759  1962                   Israel   7105.6307
## 760  1967                   Israel   8393.7414
## 761  1972                   Israel  12786.9322
## 762  1977                   Israel  13306.6192
## 763  1982                   Israel  15367.0292
## 764  1987                   Israel  17122.4799
## 765  1992                   Israel  18051.5225
## 766  1997                   Israel  20896.6092
## 767  2002                   Israel  21905.5951
## 768  2007                   Israel  25523.2771
## 769  1952                    Italy   4931.4042
## 770  1957                    Italy   6248.6562
## 771  1962                    Italy   8243.5823
## 772  1967                    Italy  10022.4013
## 773  1972                    Italy  12269.2738
## 774  1977                    Italy  14255.9847
## 775  1982                    Italy  16537.4835
## 776  1987                    Italy  19207.2348
## 777  1992                    Italy  22013.6449
## 778  1997                    Italy  24675.0245
## 779  2002                    Italy  27968.0982
## 780  2007                    Italy  28569.7197
## 781  1952                  Jamaica   2898.5309
## 782  1957                  Jamaica   4756.5258
## 783  1962                  Jamaica   5246.1075
## 784  1967                  Jamaica   6124.7035
## 785  1972                  Jamaica   7433.8893
## 786  1977                  Jamaica   6650.1956
## 787  1982                  Jamaica   6068.0513
## 788  1987                  Jamaica   6351.2375
## 789  1992                  Jamaica   7404.9237
## 790  1997                  Jamaica   7121.9247
## 791  2002                  Jamaica   6994.7749
## 792  2007                  Jamaica   7320.8803
## 793  1952                    Japan   3216.9563
## 794  1957                    Japan   4317.6944
## 795  1962                    Japan   6576.6495
## 796  1967                    Japan   9847.7886
## 797  1972                    Japan  14778.7864
## 798  1977                    Japan  16610.3770
## 799  1982                    Japan  19384.1057
## 800  1987                    Japan  22375.9419
## 801  1992                    Japan  26824.8951
## 802  1997                    Japan  28816.5850
## 803  2002                    Japan  28604.5919
## 804  2007                    Japan  31656.0681
## 805  1952                   Jordan   1546.9078
## 806  1957                   Jordan   1886.0806
## 807  1962                   Jordan   2348.0092
## 808  1967                   Jordan   2741.7963
## 809  1972                   Jordan   2110.8563
## 810  1977                   Jordan   2852.3516
## 811  1982                   Jordan   4161.4160
## 812  1987                   Jordan   4448.6799
## 813  1992                   Jordan   3431.5936
## 814  1997                   Jordan   3645.3796
## 815  2002                   Jordan   3844.9172
## 816  2007                   Jordan   4519.4612
## 817  1952                    Kenya    853.5409
## 818  1957                    Kenya    944.4383
## 819  1962                    Kenya    896.9664
## 820  1967                    Kenya   1056.7365
## 821  1972                    Kenya   1222.3600
## 822  1977                    Kenya   1267.6132
## 823  1982                    Kenya   1348.2258
## 824  1987                    Kenya   1361.9369
## 825  1992                    Kenya   1341.9217
## 826  1997                    Kenya   1360.4850
## 827  2002                    Kenya   1287.5147
## 828  2007                    Kenya   1463.2493
## 829  1952          Korea Dem. Rep.   1088.2778
## 830  1957          Korea Dem. Rep.   1571.1347
## 831  1962          Korea Dem. Rep.   1621.6936
## 832  1967          Korea Dem. Rep.   2143.5406
## 833  1972          Korea Dem. Rep.   3701.6215
## 834  1977          Korea Dem. Rep.   4106.3012
## 835  1982          Korea Dem. Rep.   4106.5253
## 836  1987          Korea Dem. Rep.   4106.4923
## 837  1992          Korea Dem. Rep.   3726.0635
## 838  1997          Korea Dem. Rep.   1690.7568
## 839  2002          Korea Dem. Rep.   1646.7582
## 840  2007          Korea Dem. Rep.   1593.0655
## 841  1952               Korea Rep.   1030.5922
## 842  1957               Korea Rep.   1487.5935
## 843  1962               Korea Rep.   1536.3444
## 844  1967               Korea Rep.   2029.2281
## 845  1972               Korea Rep.   3030.8767
## 846  1977               Korea Rep.   4657.2210
## 847  1982               Korea Rep.   5622.9425
## 848  1987               Korea Rep.   8533.0888
## 849  1992               Korea Rep.  12104.2787
## 850  1997               Korea Rep.  15993.5280
## 851  2002               Korea Rep.  19233.9882
## 852  2007               Korea Rep.  23348.1397
## 853  1952                   Kuwait 108382.3529
## 854  1957                   Kuwait 113523.1329
## 855  1962                   Kuwait  95458.1118
## 856  1967                   Kuwait  80894.8833
## 857  1972                   Kuwait 109347.8670
## 858  1977                   Kuwait  59265.4771
## 859  1982                   Kuwait  31354.0357
## 860  1987                   Kuwait  28118.4300
## 861  1992                   Kuwait  34932.9196
## 862  1997                   Kuwait  40300.6200
## 863  2002                   Kuwait  35110.1057
## 864  2007                   Kuwait  47306.9898
## 865  1952                  Lebanon   4834.8041
## 866  1957                  Lebanon   6089.7869
## 867  1962                  Lebanon   5714.5606
## 868  1967                  Lebanon   6006.9830
## 869  1972                  Lebanon   7486.3843
## 870  1977                  Lebanon   8659.6968
## 871  1982                  Lebanon   7640.5195
## 872  1987                  Lebanon   5377.0913
## 873  1992                  Lebanon   6890.8069
## 874  1997                  Lebanon   8754.9639
## 875  2002                  Lebanon   9313.9388
## 876  2007                  Lebanon  10461.0587
## 877  1952                  Lesotho    298.8462
## 878  1957                  Lesotho    335.9971
## 879  1962                  Lesotho    411.8006
## 880  1967                  Lesotho    498.6390
## 881  1972                  Lesotho    496.5816
## 882  1977                  Lesotho    745.3695
## 883  1982                  Lesotho    797.2631
## 884  1987                  Lesotho    773.9932
## 885  1992                  Lesotho    977.4863
## 886  1997                  Lesotho   1186.1480
## 887  2002                  Lesotho   1275.1846
## 888  2007                  Lesotho   1569.3314
## 889  1952                  Liberia    575.5730
## 890  1957                  Liberia    620.9700
## 891  1962                  Liberia    634.1952
## 892  1967                  Liberia    713.6036
## 893  1972                  Liberia    803.0055
## 894  1977                  Liberia    640.3224
## 895  1982                  Liberia    572.1996
## 896  1987                  Liberia    506.1139
## 897  1992                  Liberia    636.6229
## 898  1997                  Liberia    609.1740
## 899  2002                  Liberia    531.4824
## 900  2007                  Liberia    414.5073
## 901  1952                    Libya   2387.5481
## 902  1957                    Libya   3448.2844
## 903  1962                    Libya   6757.0308
## 904  1967                    Libya  18772.7517
## 905  1972                    Libya  21011.4972
## 906  1977                    Libya  21951.2118
## 907  1982                    Libya  17364.2754
## 908  1987                    Libya  11770.5898
## 909  1992                    Libya   9640.1385
## 910  1997                    Libya   9467.4461
## 911  2002                    Libya   9534.6775
## 912  2007                    Libya  12057.4993
## 913  1952               Madagascar   1443.0117
## 914  1957               Madagascar   1589.2027
## 915  1962               Madagascar   1643.3871
## 916  1967               Madagascar   1634.0473
## 917  1972               Madagascar   1748.5630
## 918  1977               Madagascar   1544.2286
## 919  1982               Madagascar   1302.8787
## 920  1987               Madagascar   1155.4419
## 921  1992               Madagascar   1040.6762
## 922  1997               Madagascar    986.2959
## 923  2002               Madagascar    894.6371
## 924  2007               Madagascar   1044.7701
## 925  1952                   Malawi    369.1651
## 926  1957                   Malawi    416.3698
## 927  1962                   Malawi    427.9011
## 928  1967                   Malawi    495.5148
## 929  1972                   Malawi    584.6220
## 930  1977                   Malawi    663.2237
## 931  1982                   Malawi    632.8039
## 932  1987                   Malawi    635.5174
## 933  1992                   Malawi    563.2000
## 934  1997                   Malawi    692.2758
## 935  2002                   Malawi    665.4231
## 936  2007                   Malawi    759.3499
## 937  1952                 Malaysia   1831.1329
## 938  1957                 Malaysia   1810.0670
## 939  1962                 Malaysia   2036.8849
## 940  1967                 Malaysia   2277.7424
## 941  1972                 Malaysia   2849.0948
## 942  1977                 Malaysia   3827.9216
## 943  1982                 Malaysia   4920.3560
## 944  1987                 Malaysia   5249.8027
## 945  1992                 Malaysia   7277.9128
## 946  1997                 Malaysia  10132.9096
## 947  2002                 Malaysia  10206.9779
## 948  2007                 Malaysia  12451.6558
## 949  1952                     Mali    452.3370
## 950  1957                     Mali    490.3822
## 951  1962                     Mali    496.1743
## 952  1967                     Mali    545.0099
## 953  1972                     Mali    581.3689
## 954  1977                     Mali    686.3953
## 955  1982                     Mali    618.0141
## 956  1987                     Mali    684.1716
## 957  1992                     Mali    739.0144
## 958  1997                     Mali    790.2580
## 959  2002                     Mali    951.4098
## 960  2007                     Mali   1042.5816
## 961  1952               Mauritania    743.1159
## 962  1957               Mauritania    846.1203
## 963  1962               Mauritania   1055.8960
## 964  1967               Mauritania   1421.1452
## 965  1972               Mauritania   1586.8518
## 966  1977               Mauritania   1497.4922
## 967  1982               Mauritania   1481.1502
## 968  1987               Mauritania   1421.6036
## 969  1992               Mauritania   1361.3698
## 970  1997               Mauritania   1483.1361
## 971  2002               Mauritania   1579.0195
## 972  2007               Mauritania   1803.1515
## 973  1952                Mauritius   1967.9557
## 974  1957                Mauritius   2034.0380
## 975  1962                Mauritius   2529.0675
## 976  1967                Mauritius   2475.3876
## 977  1972                Mauritius   2575.4842
## 978  1977                Mauritius   3710.9830
## 979  1982                Mauritius   3688.0377
## 980  1987                Mauritius   4783.5869
## 981  1992                Mauritius   6058.2538
## 982  1997                Mauritius   7425.7053
## 983  2002                Mauritius   9021.8159
## 984  2007                Mauritius  10956.9911
## 985  1952                   Mexico   3478.1255
## 986  1957                   Mexico   4131.5466
## 987  1962                   Mexico   4581.6094
## 988  1967                   Mexico   5754.7339
## 989  1972                   Mexico   6809.4067
## 990  1977                   Mexico   7674.9291
## 991  1982                   Mexico   9611.1475
## 992  1987                   Mexico   8688.1560
## 993  1992                   Mexico   9472.3843
## 994  1997                   Mexico   9767.2975
## 995  2002                   Mexico  10742.4405
## 996  2007                   Mexico  11977.5750
## 997  1952                 Mongolia    786.5669
## 998  1957                 Mongolia    912.6626
## 999  1962                 Mongolia   1056.3540
## 1000 1967                 Mongolia   1226.0411
## 1001 1972                 Mongolia   1421.7420
## 1002 1977                 Mongolia   1647.5117
## 1003 1982                 Mongolia   2000.6031
## 1004 1987                 Mongolia   2338.0083
## 1005 1992                 Mongolia   1785.4020
## 1006 1997                 Mongolia   1902.2521
## 1007 2002                 Mongolia   2140.7393
## 1008 2007                 Mongolia   3095.7723
## 1009 1952               Montenegro   2647.5856
## 1010 1957               Montenegro   3682.2599
## 1011 1962               Montenegro   4649.5938
## 1012 1967               Montenegro   5907.8509
## 1013 1972               Montenegro   7778.4140
## 1014 1977               Montenegro   9595.9299
## 1015 1982               Montenegro  11222.5876
## 1016 1987               Montenegro  11732.5102
## 1017 1992               Montenegro   7003.3390
## 1018 1997               Montenegro   6465.6133
## 1019 2002               Montenegro   6557.1943
## 1020 2007               Montenegro   9253.8961
## 1021 1952                  Morocco   1688.2036
## 1022 1957                  Morocco   1642.0023
## 1023 1962                  Morocco   1566.3535
## 1024 1967                  Morocco   1711.0448
## 1025 1972                  Morocco   1930.1950
## 1026 1977                  Morocco   2370.6200
## 1027 1982                  Morocco   2702.6204
## 1028 1987                  Morocco   2755.0470
## 1029 1992                  Morocco   2948.0473
## 1030 1997                  Morocco   2982.1019
## 1031 2002                  Morocco   3258.4956
## 1032 2007                  Morocco   3820.1752
## 1033 1952               Mozambique    468.5260
## 1034 1957               Mozambique    495.5868
## 1035 1962               Mozambique    556.6864
## 1036 1967               Mozambique    566.6692
## 1037 1972               Mozambique    724.9178
## 1038 1977               Mozambique    502.3197
## 1039 1982               Mozambique    462.2114
## 1040 1987               Mozambique    389.8762
## 1041 1992               Mozambique    410.8968
## 1042 1997               Mozambique    472.3461
## 1043 2002               Mozambique    633.6179
## 1044 2007               Mozambique    823.6856
## 1045 1952                  Myanmar    331.0000
## 1046 1957                  Myanmar    350.0000
## 1047 1962                  Myanmar    388.0000
## 1048 1967                  Myanmar    349.0000
## 1049 1972                  Myanmar    357.0000
## 1050 1977                  Myanmar    371.0000
## 1051 1982                  Myanmar    424.0000
## 1052 1987                  Myanmar    385.0000
## 1053 1992                  Myanmar    347.0000
## 1054 1997                  Myanmar    415.0000
## 1055 2002                  Myanmar    611.0000
## 1056 2007                  Myanmar    944.0000
## 1057 1952                  Namibia   2423.7804
## 1058 1957                  Namibia   2621.4481
## 1059 1962                  Namibia   3173.2156
## 1060 1967                  Namibia   3793.6948
## 1061 1972                  Namibia   3746.0809
## 1062 1977                  Namibia   3876.4860
## 1063 1982                  Namibia   4191.1005
## 1064 1987                  Namibia   3693.7313
## 1065 1992                  Namibia   3804.5380
## 1066 1997                  Namibia   3899.5243
## 1067 2002                  Namibia   4072.3248
## 1068 2007                  Namibia   4811.0604
## 1069 1952                    Nepal    545.8657
## 1070 1957                    Nepal    597.9364
## 1071 1962                    Nepal    652.3969
## 1072 1967                    Nepal    676.4422
## 1073 1972                    Nepal    674.7881
## 1074 1977                    Nepal    694.1124
## 1075 1982                    Nepal    718.3731
## 1076 1987                    Nepal    775.6325
## 1077 1992                    Nepal    897.7404
## 1078 1997                    Nepal   1010.8921
## 1079 2002                    Nepal   1057.2063
## 1080 2007                    Nepal   1091.3598
## 1081 1952              Netherlands   8941.5719
## 1082 1957              Netherlands  11276.1934
## 1083 1962              Netherlands  12790.8496
## 1084 1967              Netherlands  15363.2514
## 1085 1972              Netherlands  18794.7457
## 1086 1977              Netherlands  21209.0592
## 1087 1982              Netherlands  21399.4605
## 1088 1987              Netherlands  23651.3236
## 1089 1992              Netherlands  26790.9496
## 1090 1997              Netherlands  30246.1306
## 1091 2002              Netherlands  33724.7578
## 1092 2007              Netherlands  36797.9333
## 1093 1952              New Zealand  10556.5757
## 1094 1957              New Zealand  12247.3953
## 1095 1962              New Zealand  13175.6780
## 1096 1967              New Zealand  14463.9189
## 1097 1972              New Zealand  16046.0373
## 1098 1977              New Zealand  16233.7177
## 1099 1982              New Zealand  17632.4104
## 1100 1987              New Zealand  19007.1913
## 1101 1992              New Zealand  18363.3249
## 1102 1997              New Zealand  21050.4138
## 1103 2002              New Zealand  23189.8014
## 1104 2007              New Zealand  25185.0091
## 1105 1952                Nicaragua   3112.3639
## 1106 1957                Nicaragua   3457.4159
## 1107 1962                Nicaragua   3634.3644
## 1108 1967                Nicaragua   4643.3935
## 1109 1972                Nicaragua   4688.5933
## 1110 1977                Nicaragua   5486.3711
## 1111 1982                Nicaragua   3470.3382
## 1112 1987                Nicaragua   2955.9844
## 1113 1992                Nicaragua   2170.1517
## 1114 1997                Nicaragua   2253.0230
## 1115 2002                Nicaragua   2474.5488
## 1116 2007                Nicaragua   2749.3210
## 1117 1952                    Niger    761.8794
## 1118 1957                    Niger    835.5234
## 1119 1962                    Niger    997.7661
## 1120 1967                    Niger   1054.3849
## 1121 1972                    Niger    954.2092
## 1122 1977                    Niger    808.8971
## 1123 1982                    Niger    909.7221
## 1124 1987                    Niger    668.3000
## 1125 1992                    Niger    581.1827
## 1126 1997                    Niger    580.3052
## 1127 2002                    Niger    601.0745
## 1128 2007                    Niger    619.6769
## 1129 1952                  Nigeria   1077.2819
## 1130 1957                  Nigeria   1100.5926
## 1131 1962                  Nigeria   1150.9275
## 1132 1967                  Nigeria   1014.5141
## 1133 1972                  Nigeria   1698.3888
## 1134 1977                  Nigeria   1981.9518
## 1135 1982                  Nigeria   1576.9738
## 1136 1987                  Nigeria   1385.0296
## 1137 1992                  Nigeria   1619.8482
## 1138 1997                  Nigeria   1624.9413
## 1139 2002                  Nigeria   1615.2864
## 1140 2007                  Nigeria   2013.9773
## 1141 1952                   Norway  10095.4217
## 1142 1957                   Norway  11653.9730
## 1143 1962                   Norway  13450.4015
## 1144 1967                   Norway  16361.8765
## 1145 1972                   Norway  18965.0555
## 1146 1977                   Norway  23311.3494
## 1147 1982                   Norway  26298.6353
## 1148 1987                   Norway  31540.9748
## 1149 1992                   Norway  33965.6611
## 1150 1997                   Norway  41283.1643
## 1151 2002                   Norway  44683.9753
## 1152 2007                   Norway  49357.1902
## 1153 1952                     Oman   1828.2303
## 1154 1957                     Oman   2242.7466
## 1155 1962                     Oman   2924.6381
## 1156 1967                     Oman   4720.9427
## 1157 1972                     Oman  10618.0385
## 1158 1977                     Oman  11848.3439
## 1159 1982                     Oman  12954.7910
## 1160 1987                     Oman  18115.2231
## 1161 1992                     Oman  18616.7069
## 1162 1997                     Oman  19702.0558
## 1163 2002                     Oman  19774.8369
## 1164 2007                     Oman  22316.1929
## 1165 1952                 Pakistan    684.5971
## 1166 1957                 Pakistan    747.0835
## 1167 1962                 Pakistan    803.3427
## 1168 1967                 Pakistan    942.4083
## 1169 1972                 Pakistan   1049.9390
## 1170 1977                 Pakistan   1175.9212
## 1171 1982                 Pakistan   1443.4298
## 1172 1987                 Pakistan   1704.6866
## 1173 1992                 Pakistan   1971.8295
## 1174 1997                 Pakistan   2049.3505
## 1175 2002                 Pakistan   2092.7124
## 1176 2007                 Pakistan   2605.9476
## 1177 1952                   Panama   2480.3803
## 1178 1957                   Panama   2961.8009
## 1179 1962                   Panama   3536.5403
## 1180 1967                   Panama   4421.0091
## 1181 1972                   Panama   5364.2497
## 1182 1977                   Panama   5351.9121
## 1183 1982                   Panama   7009.6016
## 1184 1987                   Panama   7034.7792
## 1185 1992                   Panama   6618.7431
## 1186 1997                   Panama   7113.6923
## 1187 2002                   Panama   7356.0319
## 1188 2007                   Panama   9809.1856
## 1189 1952                 Paraguay   1952.3087
## 1190 1957                 Paraguay   2046.1547
## 1191 1962                 Paraguay   2148.0271
## 1192 1967                 Paraguay   2299.3763
## 1193 1972                 Paraguay   2523.3380
## 1194 1977                 Paraguay   3248.3733
## 1195 1982                 Paraguay   4258.5036
## 1196 1987                 Paraguay   3998.8757
## 1197 1992                 Paraguay   4196.4111
## 1198 1997                 Paraguay   4247.4003
## 1199 2002                 Paraguay   3783.6742
## 1200 2007                 Paraguay   4172.8385
## 1201 1952                     Peru   3758.5234
## 1202 1957                     Peru   4245.2567
## 1203 1962                     Peru   4957.0380
## 1204 1967                     Peru   5788.0933
## 1205 1972                     Peru   5937.8273
## 1206 1977                     Peru   6281.2909
## 1207 1982                     Peru   6434.5018
## 1208 1987                     Peru   6360.9434
## 1209 1992                     Peru   4446.3809
## 1210 1997                     Peru   5838.3477
## 1211 2002                     Peru   5909.0201
## 1212 2007                     Peru   7408.9056
## 1213 1952              Philippines   1272.8810
## 1214 1957              Philippines   1547.9448
## 1215 1962              Philippines   1649.5522
## 1216 1967              Philippines   1814.1274
## 1217 1972              Philippines   1989.3741
## 1218 1977              Philippines   2373.2043
## 1219 1982              Philippines   2603.2738
## 1220 1987              Philippines   2189.6350
## 1221 1992              Philippines   2279.3240
## 1222 1997              Philippines   2536.5349
## 1223 2002              Philippines   2650.9211
## 1224 2007              Philippines   3190.4810
## 1225 1952                   Poland   4029.3297
## 1226 1957                   Poland   4734.2530
## 1227 1962                   Poland   5338.7521
## 1228 1967                   Poland   6557.1528
## 1229 1972                   Poland   8006.5070
## 1230 1977                   Poland   9508.1415
## 1231 1982                   Poland   8451.5310
## 1232 1987                   Poland   9082.3512
## 1233 1992                   Poland   7738.8812
## 1234 1997                   Poland  10159.5837
## 1235 2002                   Poland  12002.2391
## 1236 2007                   Poland  15389.9247
## 1237 1952                 Portugal   3068.3199
## 1238 1957                 Portugal   3774.5717
## 1239 1962                 Portugal   4727.9549
## 1240 1967                 Portugal   6361.5180
## 1241 1972                 Portugal   9022.2474
## 1242 1977                 Portugal  10172.4857
## 1243 1982                 Portugal  11753.8429
## 1244 1987                 Portugal  13039.3088
## 1245 1992                 Portugal  16207.2666
## 1246 1997                 Portugal  17641.0316
## 1247 2002                 Portugal  19970.9079
## 1248 2007                 Portugal  20509.6478
## 1249 1952              Puerto Rico   3081.9598
## 1250 1957              Puerto Rico   3907.1562
## 1251 1962              Puerto Rico   5108.3446
## 1252 1967              Puerto Rico   6929.2777
## 1253 1972              Puerto Rico   9123.0417
## 1254 1977              Puerto Rico   9770.5249
## 1255 1982              Puerto Rico  10330.9891
## 1256 1987              Puerto Rico  12281.3419
## 1257 1992              Puerto Rico  14641.5871
## 1258 1997              Puerto Rico  16999.4333
## 1259 2002              Puerto Rico  18855.6062
## 1260 2007              Puerto Rico  19328.7090
## 1261 1952                  Reunion   2718.8853
## 1262 1957                  Reunion   2769.4518
## 1263 1962                  Reunion   3173.7233
## 1264 1967                  Reunion   4021.1757
## 1265 1972                  Reunion   5047.6586
## 1266 1977                  Reunion   4319.8041
## 1267 1982                  Reunion   5267.2194
## 1268 1987                  Reunion   5303.3775
## 1269 1992                  Reunion   6101.2558
## 1270 1997                  Reunion   6071.9414
## 1271 2002                  Reunion   6316.1652
## 1272 2007                  Reunion   7670.1226
## 1273 1952                  Romania   3144.6132
## 1274 1957                  Romania   3943.3702
## 1275 1962                  Romania   4734.9976
## 1276 1967                  Romania   6470.8665
## 1277 1972                  Romania   8011.4144
## 1278 1977                  Romania   9356.3972
## 1279 1982                  Romania   9605.3141
## 1280 1987                  Romania   9696.2733
## 1281 1992                  Romania   6598.4099
## 1282 1997                  Romania   7346.5476
## 1283 2002                  Romania   7885.3601
## 1284 2007                  Romania  10808.4756
## 1285 1952                   Rwanda    493.3239
## 1286 1957                   Rwanda    540.2894
## 1287 1962                   Rwanda    597.4731
## 1288 1967                   Rwanda    510.9637
## 1289 1972                   Rwanda    590.5807
## 1290 1977                   Rwanda    670.0806
## 1291 1982                   Rwanda    881.5706
## 1292 1987                   Rwanda    847.9912
## 1293 1992                   Rwanda    737.0686
## 1294 1997                   Rwanda    589.9445
## 1295 2002                   Rwanda    785.6538
## 1296 2007                   Rwanda    863.0885
## 1297 1952    Sao Tome and Principe    879.5836
## 1298 1957    Sao Tome and Principe    860.7369
## 1299 1962    Sao Tome and Principe   1071.5511
## 1300 1967    Sao Tome and Principe   1384.8406
## 1301 1972    Sao Tome and Principe   1532.9853
## 1302 1977    Sao Tome and Principe   1737.5617
## 1303 1982    Sao Tome and Principe   1890.2181
## 1304 1987    Sao Tome and Principe   1516.5255
## 1305 1992    Sao Tome and Principe   1428.7778
## 1306 1997    Sao Tome and Principe   1339.0760
## 1307 2002    Sao Tome and Principe   1353.0924
## 1308 2007    Sao Tome and Principe   1598.4351
## 1309 1952             Saudi Arabia   6459.5548
## 1310 1957             Saudi Arabia   8157.5912
## 1311 1962             Saudi Arabia  11626.4197
## 1312 1967             Saudi Arabia  16903.0489
## 1313 1972             Saudi Arabia  24837.4287
## 1314 1977             Saudi Arabia  34167.7626
## 1315 1982             Saudi Arabia  33693.1753
## 1316 1987             Saudi Arabia  21198.2614
## 1317 1992             Saudi Arabia  24841.6178
## 1318 1997             Saudi Arabia  20586.6902
## 1319 2002             Saudi Arabia  19014.5412
## 1320 2007             Saudi Arabia  21654.8319
## 1321 1952                  Senegal   1450.3570
## 1322 1957                  Senegal   1567.6530
## 1323 1962                  Senegal   1654.9887
## 1324 1967                  Senegal   1612.4046
## 1325 1972                  Senegal   1597.7121
## 1326 1977                  Senegal   1561.7691
## 1327 1982                  Senegal   1518.4800
## 1328 1987                  Senegal   1441.7207
## 1329 1992                  Senegal   1367.8994
## 1330 1997                  Senegal   1392.3683
## 1331 2002                  Senegal   1519.6353
## 1332 2007                  Senegal   1712.4721
## 1333 1952                   Serbia   3581.4594
## 1334 1957                   Serbia   4981.0909
## 1335 1962                   Serbia   6289.6292
## 1336 1967                   Serbia   7991.7071
## 1337 1972                   Serbia  10522.0675
## 1338 1977                   Serbia  12980.6696
## 1339 1982                   Serbia  15181.0927
## 1340 1987                   Serbia  15870.8785
## 1341 1992                   Serbia   9325.0682
## 1342 1997                   Serbia   7914.3203
## 1343 2002                   Serbia   7236.0753
## 1344 2007                   Serbia   9786.5347
## 1345 1952             Sierra Leone    879.7877
## 1346 1957             Sierra Leone   1004.4844
## 1347 1962             Sierra Leone   1116.6399
## 1348 1967             Sierra Leone   1206.0435
## 1349 1972             Sierra Leone   1353.7598
## 1350 1977             Sierra Leone   1348.2852
## 1351 1982             Sierra Leone   1465.0108
## 1352 1987             Sierra Leone   1294.4478
## 1353 1992             Sierra Leone   1068.6963
## 1354 1997             Sierra Leone    574.6482
## 1355 2002             Sierra Leone    699.4897
## 1356 2007             Sierra Leone    862.5408
## 1357 1952                Singapore   2315.1382
## 1358 1957                Singapore   2843.1044
## 1359 1962                Singapore   3674.7356
## 1360 1967                Singapore   4977.4185
## 1361 1972                Singapore   8597.7562
## 1362 1977                Singapore  11210.0895
## 1363 1982                Singapore  15169.1611
## 1364 1987                Singapore  18861.5308
## 1365 1992                Singapore  24769.8912
## 1366 1997                Singapore  33519.4766
## 1367 2002                Singapore  36023.1054
## 1368 2007                Singapore  47143.1796
## 1369 1952          Slovak Republic   5074.6591
## 1370 1957          Slovak Republic   6093.2630
## 1371 1962          Slovak Republic   7481.1076
## 1372 1967          Slovak Republic   8412.9024
## 1373 1972          Slovak Republic   9674.1676
## 1374 1977          Slovak Republic  10922.6640
## 1375 1982          Slovak Republic  11348.5459
## 1376 1987          Slovak Republic  12037.2676
## 1377 1992          Slovak Republic   9498.4677
## 1378 1997          Slovak Republic  12126.2306
## 1379 2002          Slovak Republic  13638.7784
## 1380 2007          Slovak Republic  18678.3144
## 1381 1952                 Slovenia   4215.0417
## 1382 1957                 Slovenia   5862.2766
## 1383 1962                 Slovenia   7402.3034
## 1384 1967                 Slovenia   9405.4894
## 1385 1972                 Slovenia  12383.4862
## 1386 1977                 Slovenia  15277.0302
## 1387 1982                 Slovenia  17866.7218
## 1388 1987                 Slovenia  18678.5349
## 1389 1992                 Slovenia  14214.7168
## 1390 1997                 Slovenia  17161.1073
## 1391 2002                 Slovenia  20660.0194
## 1392 2007                 Slovenia  25768.2576
## 1393 1952                  Somalia   1135.7498
## 1394 1957                  Somalia   1258.1474
## 1395 1962                  Somalia   1369.4883
## 1396 1967                  Somalia   1284.7332
## 1397 1972                  Somalia   1254.5761
## 1398 1977                  Somalia   1450.9925
## 1399 1982                  Somalia   1176.8070
## 1400 1987                  Somalia   1093.2450
## 1401 1992                  Somalia    926.9603
## 1402 1997                  Somalia    930.5964
## 1403 2002                  Somalia    882.0818
## 1404 2007                  Somalia    926.1411
## 1405 1952             South Africa   4725.2955
## 1406 1957             South Africa   5487.1042
## 1407 1962             South Africa   5768.7297
## 1408 1967             South Africa   7114.4780
## 1409 1972             South Africa   7765.9626
## 1410 1977             South Africa   8028.6514
## 1411 1982             South Africa   8568.2662
## 1412 1987             South Africa   7825.8234
## 1413 1992             South Africa   7225.0693
## 1414 1997             South Africa   7479.1882
## 1415 2002             South Africa   7710.9464
## 1416 2007             South Africa   9269.6578
## 1417 1952                    Spain   3834.0347
## 1418 1957                    Spain   4564.8024
## 1419 1962                    Spain   5693.8439
## 1420 1967                    Spain   7993.5123
## 1421 1972                    Spain  10638.7513
## 1422 1977                    Spain  13236.9212
## 1423 1982                    Spain  13926.1700
## 1424 1987                    Spain  15764.9831
## 1425 1992                    Spain  18603.0645
## 1426 1997                    Spain  20445.2990
## 1427 2002                    Spain  24835.4717
## 1428 2007                    Spain  28821.0637
## 1429 1952                Sri Lanka   1083.5320
## 1430 1957                Sri Lanka   1072.5466
## 1431 1962                Sri Lanka   1074.4720
## 1432 1967                Sri Lanka   1135.5143
## 1433 1972                Sri Lanka   1213.3955
## 1434 1977                Sri Lanka   1348.7757
## 1435 1982                Sri Lanka   1648.0798
## 1436 1987                Sri Lanka   1876.7668
## 1437 1992                Sri Lanka   2153.7392
## 1438 1997                Sri Lanka   2664.4773
## 1439 2002                Sri Lanka   3015.3788
## 1440 2007                Sri Lanka   3970.0954
## 1441 1952                    Sudan   1615.9911
## 1442 1957                    Sudan   1770.3371
## 1443 1962                    Sudan   1959.5938
## 1444 1967                    Sudan   1687.9976
## 1445 1972                    Sudan   1659.6528
## 1446 1977                    Sudan   2202.9884
## 1447 1982                    Sudan   1895.5441
## 1448 1987                    Sudan   1507.8192
## 1449 1992                    Sudan   1492.1970
## 1450 1997                    Sudan   1632.2108
## 1451 2002                    Sudan   1993.3983
## 1452 2007                    Sudan   2602.3950
## 1453 1952                Swaziland   1148.3766
## 1454 1957                Swaziland   1244.7084
## 1455 1962                Swaziland   1856.1821
## 1456 1967                Swaziland   2613.1017
## 1457 1972                Swaziland   3364.8366
## 1458 1977                Swaziland   3781.4106
## 1459 1982                Swaziland   3895.3840
## 1460 1987                Swaziland   3984.8398
## 1461 1992                Swaziland   3553.0224
## 1462 1997                Swaziland   3876.7685
## 1463 2002                Swaziland   4128.1169
## 1464 2007                Swaziland   4513.4806
## 1465 1952                   Sweden   8527.8447
## 1466 1957                   Sweden   9911.8782
## 1467 1962                   Sweden  12329.4419
## 1468 1967                   Sweden  15258.2970
## 1469 1972                   Sweden  17832.0246
## 1470 1977                   Sweden  18855.7252
## 1471 1982                   Sweden  20667.3812
## 1472 1987                   Sweden  23586.9293
## 1473 1992                   Sweden  23880.0168
## 1474 1997                   Sweden  25266.5950
## 1475 2002                   Sweden  29341.6309
## 1476 2007                   Sweden  33859.7484
## 1477 1952              Switzerland  14734.2327
## 1478 1957              Switzerland  17909.4897
## 1479 1962              Switzerland  20431.0927
## 1480 1967              Switzerland  22966.1443
## 1481 1972              Switzerland  27195.1130
## 1482 1977              Switzerland  26982.2905
## 1483 1982              Switzerland  28397.7151
## 1484 1987              Switzerland  30281.7046
## 1485 1992              Switzerland  31871.5303
## 1486 1997              Switzerland  32135.3230
## 1487 2002              Switzerland  34480.9577
## 1488 2007              Switzerland  37506.4191
## 1489 1952                    Syria   1643.4854
## 1490 1957                    Syria   2117.2349
## 1491 1962                    Syria   2193.0371
## 1492 1967                    Syria   1881.9236
## 1493 1972                    Syria   2571.4230
## 1494 1977                    Syria   3195.4846
## 1495 1982                    Syria   3761.8377
## 1496 1987                    Syria   3116.7743
## 1497 1992                    Syria   3340.5428
## 1498 1997                    Syria   4014.2390
## 1499 2002                    Syria   4090.9253
## 1500 2007                    Syria   4184.5481
## 1501 1952                   Taiwan   1206.9479
## 1502 1957                   Taiwan   1507.8613
## 1503 1962                   Taiwan   1822.8790
## 1504 1967                   Taiwan   2643.8587
## 1505 1972                   Taiwan   4062.5239
## 1506 1977                   Taiwan   5596.5198
## 1507 1982                   Taiwan   7426.3548
## 1508 1987                   Taiwan  11054.5618
## 1509 1992                   Taiwan  15215.6579
## 1510 1997                   Taiwan  20206.8210
## 1511 2002                   Taiwan  23235.4233
## 1512 2007                   Taiwan  28718.2768
## 1513 1952                 Tanzania    716.6501
## 1514 1957                 Tanzania    698.5356
## 1515 1962                 Tanzania    722.0038
## 1516 1967                 Tanzania    848.2187
## 1517 1972                 Tanzania    915.9851
## 1518 1977                 Tanzania    962.4923
## 1519 1982                 Tanzania    874.2426
## 1520 1987                 Tanzania    831.8221
## 1521 1992                 Tanzania    825.6825
## 1522 1997                 Tanzania    789.1862
## 1523 2002                 Tanzania    899.0742
## 1524 2007                 Tanzania   1107.4822
## 1525 1952                 Thailand    757.7974
## 1526 1957                 Thailand    793.5774
## 1527 1962                 Thailand   1002.1992
## 1528 1967                 Thailand   1295.4607
## 1529 1972                 Thailand   1524.3589
## 1530 1977                 Thailand   1961.2246
## 1531 1982                 Thailand   2393.2198
## 1532 1987                 Thailand   2982.6538
## 1533 1992                 Thailand   4616.8965
## 1534 1997                 Thailand   5852.6255
## 1535 2002                 Thailand   5913.1875
## 1536 2007                 Thailand   7458.3963
## 1537 1952                     Togo    859.8087
## 1538 1957                     Togo    925.9083
## 1539 1962                     Togo   1067.5348
## 1540 1967                     Togo   1477.5968
## 1541 1972                     Togo   1649.6602
## 1542 1977                     Togo   1532.7770
## 1543 1982                     Togo   1344.5780
## 1544 1987                     Togo   1202.2014
## 1545 1992                     Togo   1034.2989
## 1546 1997                     Togo    982.2869
## 1547 2002                     Togo    886.2206
## 1548 2007                     Togo    882.9699
## 1549 1952      Trinidad and Tobago   3023.2719
## 1550 1957      Trinidad and Tobago   4100.3934
## 1551 1962      Trinidad and Tobago   4997.5240
## 1552 1967      Trinidad and Tobago   5621.3685
## 1553 1972      Trinidad and Tobago   6619.5514
## 1554 1977      Trinidad and Tobago   7899.5542
## 1555 1982      Trinidad and Tobago   9119.5286
## 1556 1987      Trinidad and Tobago   7388.5978
## 1557 1992      Trinidad and Tobago   7370.9909
## 1558 1997      Trinidad and Tobago   8792.5731
## 1559 2002      Trinidad and Tobago  11460.6002
## 1560 2007      Trinidad and Tobago  18008.5092
## 1561 1952                  Tunisia   1468.4756
## 1562 1957                  Tunisia   1395.2325
## 1563 1962                  Tunisia   1660.3032
## 1564 1967                  Tunisia   1932.3602
## 1565 1972                  Tunisia   2753.2860
## 1566 1977                  Tunisia   3120.8768
## 1567 1982                  Tunisia   3560.2332
## 1568 1987                  Tunisia   3810.4193
## 1569 1992                  Tunisia   4332.7202
## 1570 1997                  Tunisia   4876.7986
## 1571 2002                  Tunisia   5722.8957
## 1572 2007                  Tunisia   7092.9230
## 1573 1952                   Turkey   1969.1010
## 1574 1957                   Turkey   2218.7543
## 1575 1962                   Turkey   2322.8699
## 1576 1967                   Turkey   2826.3564
## 1577 1972                   Turkey   3450.6964
## 1578 1977                   Turkey   4269.1223
## 1579 1982                   Turkey   4241.3563
## 1580 1987                   Turkey   5089.0437
## 1581 1992                   Turkey   5678.3483
## 1582 1997                   Turkey   6601.4299
## 1583 2002                   Turkey   6508.0857
## 1584 2007                   Turkey   8458.2764
## 1585 1952                   Uganda    734.7535
## 1586 1957                   Uganda    774.3711
## 1587 1962                   Uganda    767.2717
## 1588 1967                   Uganda    908.9185
## 1589 1972                   Uganda    950.7359
## 1590 1977                   Uganda    843.7331
## 1591 1982                   Uganda    682.2662
## 1592 1987                   Uganda    617.7244
## 1593 1992                   Uganda    644.1708
## 1594 1997                   Uganda    816.5591
## 1595 2002                   Uganda    927.7210
## 1596 2007                   Uganda   1056.3801
## 1597 1952           United Kingdom   9979.5085
## 1598 1957           United Kingdom  11283.1779
## 1599 1962           United Kingdom  12477.1771
## 1600 1967           United Kingdom  14142.8509
## 1601 1972           United Kingdom  15895.1164
## 1602 1977           United Kingdom  17428.7485
## 1603 1982           United Kingdom  18232.4245
## 1604 1987           United Kingdom  21664.7877
## 1605 1992           United Kingdom  22705.0925
## 1606 1997           United Kingdom  26074.5314
## 1607 2002           United Kingdom  29478.9992
## 1608 2007           United Kingdom  33203.2613
## 1609 1952            United States  13990.4821
## 1610 1957            United States  14847.1271
## 1611 1962            United States  16173.1459
## 1612 1967            United States  19530.3656
## 1613 1972            United States  21806.0359
## 1614 1977            United States  24072.6321
## 1615 1982            United States  25009.5591
## 1616 1987            United States  29884.3504
## 1617 1992            United States  32003.9322
## 1618 1997            United States  35767.4330
## 1619 2002            United States  39097.0995
## 1620 2007            United States  42951.6531
## 1621 1952                  Uruguay   5716.7667
## 1622 1957                  Uruguay   6150.7730
## 1623 1962                  Uruguay   5603.3577
## 1624 1967                  Uruguay   5444.6196
## 1625 1972                  Uruguay   5703.4089
## 1626 1977                  Uruguay   6504.3397
## 1627 1982                  Uruguay   6920.2231
## 1628 1987                  Uruguay   7452.3990
## 1629 1992                  Uruguay   8137.0048
## 1630 1997                  Uruguay   9230.2407
## 1631 2002                  Uruguay   7727.0020
## 1632 2007                  Uruguay  10611.4630
## 1633 1952                Venezuela   7689.7998
## 1634 1957                Venezuela   9802.4665
## 1635 1962                Venezuela   8422.9742
## 1636 1967                Venezuela   9541.4742
## 1637 1972                Venezuela  10505.2597
## 1638 1977                Venezuela  13143.9510
## 1639 1982                Venezuela  11152.4101
## 1640 1987                Venezuela   9883.5846
## 1641 1992                Venezuela  10733.9263
## 1642 1997                Venezuela  10165.4952
## 1643 2002                Venezuela   8605.0478
## 1644 2007                Venezuela  11415.8057
## 1645 1952                  Vietnam    605.0665
## 1646 1957                  Vietnam    676.2854
## 1647 1962                  Vietnam    772.0492
## 1648 1967                  Vietnam    637.1233
## 1649 1972                  Vietnam    699.5016
## 1650 1977                  Vietnam    713.5371
## 1651 1982                  Vietnam    707.2358
## 1652 1987                  Vietnam    820.7994
## 1653 1992                  Vietnam    989.0231
## 1654 1997                  Vietnam   1385.8968
## 1655 2002                  Vietnam   1764.4567
## 1656 2007                  Vietnam   2441.5764
## 1657 1952       West Bank and Gaza   1515.5923
## 1658 1957       West Bank and Gaza   1827.0677
## 1659 1962       West Bank and Gaza   2198.9563
## 1660 1967       West Bank and Gaza   2649.7150
## 1661 1972       West Bank and Gaza   3133.4093
## 1662 1977       West Bank and Gaza   3682.8315
## 1663 1982       West Bank and Gaza   4336.0321
## 1664 1987       West Bank and Gaza   5107.1974
## 1665 1992       West Bank and Gaza   6017.6548
## 1666 1997       West Bank and Gaza   7110.6676
## 1667 2002       West Bank and Gaza   4515.4876
## 1668 2007       West Bank and Gaza   3025.3498
## 1669 1952               Yemen Rep.    781.7176
## 1670 1957               Yemen Rep.    804.8305
## 1671 1962               Yemen Rep.    825.6232
## 1672 1967               Yemen Rep.    862.4421
## 1673 1972               Yemen Rep.   1265.0470
## 1674 1977               Yemen Rep.   1829.7652
## 1675 1982               Yemen Rep.   1977.5570
## 1676 1987               Yemen Rep.   1971.7415
## 1677 1992               Yemen Rep.   1879.4967
## 1678 1997               Yemen Rep.   2117.4845
## 1679 2002               Yemen Rep.   2234.8208
## 1680 2007               Yemen Rep.   2280.7699
## 1681 1952                   Zambia   1147.3888
## 1682 1957                   Zambia   1311.9568
## 1683 1962                   Zambia   1452.7258
## 1684 1967                   Zambia   1777.0773
## 1685 1972                   Zambia   1773.4983
## 1686 1977                   Zambia   1588.6883
## 1687 1982                   Zambia   1408.6786
## 1688 1987                   Zambia   1213.3151
## 1689 1992                   Zambia   1210.8846
## 1690 1997                   Zambia   1071.3538
## 1691 2002                   Zambia   1071.6139
## 1692 2007                   Zambia   1271.2116
## 1693 1952                 Zimbabwe    406.8841
## 1694 1957                 Zimbabwe    518.7643
## 1695 1962                 Zimbabwe    527.2722
## 1696 1967                 Zimbabwe    569.7951
## 1697 1972                 Zimbabwe    799.3622
## 1698 1977                 Zimbabwe    685.5877
## 1699 1982                 Zimbabwe    788.8550
## 1700 1987                 Zimbabwe    706.1573
## 1701 1992                 Zimbabwe    693.4208
## 1702 1997                 Zimbabwe    792.4500
## 1703 2002                 Zimbabwe    672.0386
## 1704 2007                 Zimbabwe    469.7093
#save the output of the pipe with a new variable
year_country_gdp <- gap %>% 
  select(year, country, gdpPercap)
head(year_country_gdp)
##   year     country gdpPercap
## 1 1952 Afghanistan  779.4453
## 2 1957 Afghanistan  820.8530
## 3 1962 Afghanistan  853.1007
## 4 1967 Afghanistan  836.1971
## 5 1972 Afghanistan  739.9811
## 6 1977 Afghanistan  786.1134

Filter Rows with filter

year_country_gdp_africa <- gap %>%
    filter(continent == "Africa") %>%
    select(year, country, gdpPercap)
head(year_country_gdp_africa)
##   year country gdpPercap
## 1 1952 Algeria  2449.008
## 2 1957 Algeria  3013.976
## 3 1962 Algeria  2550.817
## 4 1967 Algeria  3246.992
## 5 1972 Algeria  4182.664
## 6 1977 Algeria  4910.417

Comparisons

Comparison operators: >, >=, <, <=, != (not equal), and == (equal).

Missing values

NA > 5
## [1] NA
10 == NA
## [1] NA
NA + 10
## [1] NA
NA / 2
## [1] NA
#not run
is.na(x)

Calculate Across Groups with group_by

mean(gap$gdpPercap[gap$continent == "Africa"])
## [1] 2193.755
mean(gap$gdpPercap[gap$continent == "Americas"])
## [1] 7136.11
mean(gap$gdpPercap[gap$continent == "Asia"])
## [1] 7902.15
mean(gap$gdpPercap[gap$continent == "Europe"])
## [1] 14469.48
mean(gap$gdpPercap[gap$continent == "Oceania"])
## [1] 18621.61

split-apply-combine

knitr::include_graphics(path = "diagrams/splitapply.png")

group_by

knitr::include_graphics(path = "diagrams/dplyr-fig2.png")

Summarize Across Groups with summarize

gdp_bycontinents <- gap %>%
    group_by(continent) %>%
    summarize(mean_gdpPercap = mean(gdpPercap))

gdp_bycontinents
## # A tibble: 5 x 2
##   continent mean_gdpPercap
##   <fct>              <dbl>
## 1 Africa             2194.
## 2 Americas           7136.
## 3 Asia               7902.
## 4 Europe            14469.
## 5 Oceania           18622.
knitr::include_graphics(path = "diagrams/dplyr-fig3.png")

gdp_bycontinents_byyear <- gap %>%
    group_by(continent, year) %>%
    summarize(mean_gdpPercap = mean(gdpPercap))

gdp_bycontinents_byyear
## # A tibble: 60 x 3
## # Groups:   continent [5]
##    continent  year mean_gdpPercap
##    <fct>     <int>          <dbl>
##  1 Africa     1952          1253.
##  2 Africa     1957          1385.
##  3 Africa     1962          1598.
##  4 Africa     1967          2050.
##  5 Africa     1972          2340.
##  6 Africa     1977          2586.
##  7 Africa     1982          2482.
##  8 Africa     1987          2283.
##  9 Africa     1992          2282.
## 10 Africa     1997          2379.
## # … with 50 more rows
gdp_pop_bycontinents_byyear <- gap %>%
    group_by(continent, year) %>%
    summarize(mean_gdpPercap = mean(gdpPercap),
              sd_gdpPercap = sd(gdpPercap),
              mean_pop = mean(pop),
              sd_pop = sd(pop))

gdp_pop_bycontinents_byyear
## # A tibble: 60 x 6
## # Groups:   continent [5]
##    continent  year mean_gdpPercap sd_gdpPercap  mean_pop    sd_pop
##    <fct>     <int>          <dbl>        <dbl>     <dbl>     <dbl>
##  1 Africa     1952          1253.         983.  4570010.  6317450.
##  2 Africa     1957          1385.        1135.  5093033.  7076042.
##  3 Africa     1962          1598.        1462.  5702247.  7957545.
##  4 Africa     1967          2050.        2848.  6447875.  8985505.
##  5 Africa     1972          2340.        3287.  7305376. 10130833.
##  6 Africa     1977          2586.        4142.  8328097. 11585184.
##  7 Africa     1982          2482.        3243.  9602857. 13456243.
##  8 Africa     1987          2283.        2567. 11054502. 15277484.
##  9 Africa     1992          2282.        2644. 12674645. 17562719.
## 10 Africa     1997          2379.        2821. 14304480. 19873013.
## # … with 50 more rows

Add New Variables with mutate

gapminder_with_extra_vars <- gap %>%
    group_by(continent, year) %>%
    mutate(mean_gdpPercap = mean(gdpPercap),
              sd_gdpPercap = sd(gdpPercap),
              mean_pop = mean(pop),
              sd_pop = sd(pop))

gapminder_with_extra_vars
## # A tibble: 1,704 x 10
## # Groups:   continent, year [60]
##    country  year    pop continent lifeExp gdpPercap mean_gdpPercap sd_gdpPercap
##    <fct>   <int>  <dbl> <fct>       <dbl>     <dbl>          <dbl>        <dbl>
##  1 Afghan…  1952 8.43e6 Asia         28.8      779.          5195.       18635.
##  2 Afghan…  1957 9.24e6 Asia         30.3      821.          5788.       19507.
##  3 Afghan…  1962 1.03e7 Asia         32.0      853.          5729.       16416.
##  4 Afghan…  1967 1.15e7 Asia         34.0      836.          5971.       14063.
##  5 Afghan…  1972 1.31e7 Asia         36.1      740.          8187.       19088.
##  6 Afghan…  1977 1.49e7 Asia         38.4      786.          7791.       11816.
##  7 Afghan…  1982 1.29e7 Asia         39.9      978.          7434.        8701.
##  8 Afghan…  1987 1.39e7 Asia         40.8      852.          7608.        8090.
##  9 Afghan…  1992 1.63e7 Asia         41.7      649.          8640.        9727.
## 10 Afghan…  1997 2.22e7 Asia         41.8      635.          9834.       11094.
## # … with 1,694 more rows, and 2 more variables: mean_pop <dbl>, sd_pop <dbl>
gdp_pop_bycontinents_byyear <- gap %>%
    mutate(gdp_billion = gdpPercap*pop/10^9) %>%
    group_by(continent, year) %>%
    summarize(mean_gdpPercap = mean(gdpPercap),
              sd_gdpPercap = sd(gdpPercap),
              mean_pop = mean(pop),
              sd_pop = sd(pop),
              mean_gdp_billion = mean(gdp_billion),
              sd_gdp_billion = sd(gdp_billion))

gdp_pop_bycontinents_byyear
## # A tibble: 60 x 8
## # Groups:   continent [5]
##    continent  year mean_gdpPercap sd_gdpPercap mean_pop sd_pop mean_gdp_billion
##    <fct>     <int>          <dbl>        <dbl>    <dbl>  <dbl>            <dbl>
##  1 Africa     1952          1253.         983.   4.57e6 6.32e6             5.99
##  2 Africa     1957          1385.        1135.   5.09e6 7.08e6             7.36
##  3 Africa     1962          1598.        1462.   5.70e6 7.96e6             8.78
##  4 Africa     1967          2050.        2848.   6.45e6 8.99e6            11.4 
##  5 Africa     1972          2340.        3287.   7.31e6 1.01e7            15.1 
##  6 Africa     1977          2586.        4142.   8.33e6 1.16e7            18.7 
##  7 Africa     1982          2482.        3243.   9.60e6 1.35e7            22.0 
##  8 Africa     1987          2283.        2567.   1.11e7 1.53e7            24.1 
##  9 Africa     1992          2282.        2644.   1.27e7 1.76e7            26.3 
## 10 Africa     1997          2379.        2821.   1.43e7 1.99e7            30.0 
## # … with 50 more rows, and 1 more variable: sd_gdp_billion <dbl>

Arrange Rows with arrange

gapminder_with_extra_vars <- gap %>%
    group_by(continent, year) %>%
    mutate(mean_gdpPercap = mean(gdpPercap),
              sd_gdpPercap = sd(gdpPercap),
              mean_pop = mean(pop),
              sd_pop = sd(pop)) %>%
    arrange(desc(year), continent)

gapminder_with_extra_vars
## # A tibble: 1,704 x 10
## # Groups:   continent, year [60]
##    country  year    pop continent lifeExp gdpPercap mean_gdpPercap sd_gdpPercap
##    <fct>   <int>  <dbl> <fct>       <dbl>     <dbl>          <dbl>        <dbl>
##  1 Algeria  2007 3.33e7 Africa       72.3     6223.          3089.        3618.
##  2 Angola   2007 1.24e7 Africa       42.7     4797.          3089.        3618.
##  3 Benin    2007 8.08e6 Africa       56.7     1441.          3089.        3618.
##  4 Botswa…  2007 1.64e6 Africa       50.7    12570.          3089.        3618.
##  5 Burkin…  2007 1.43e7 Africa       52.3     1217.          3089.        3618.
##  6 Burundi  2007 8.39e6 Africa       49.6      430.          3089.        3618.
##  7 Camero…  2007 1.77e7 Africa       50.4     2042.          3089.        3618.
##  8 Centra…  2007 4.37e6 Africa       44.7      706.          3089.        3618.
##  9 Chad     2007 1.02e7 Africa       50.7     1704.          3089.        3618.
## 10 Comoros  2007 7.11e5 Africa       65.2      986.          3089.        3618.
## # … with 1,694 more rows, and 2 more variables: mean_pop <dbl>, sd_pop <dbl>

Exercises

For these exercises we’ll be usinh the flights dataset. This data frame contains all 336,776 flights that departed from New York City in 2013. The data comes from the US Bureau of Transportation Statistics, and is documented in ?flights.

library(nycflights13)
library(tidyverse)
flights
## # A tibble: 336,776 x 19
##     year month   day dep_time sched_dep_time dep_delay arr_time sched_arr_time
##    <int> <int> <int>    <int>          <int>     <dbl>    <int>          <int>
##  1  2013     1     1      517            515         2      830            819
##  2  2013     1     1      533            529         4      850            830
##  3  2013     1     1      542            540         2      923            850
##  4  2013     1     1      544            545        -1     1004           1022
##  5  2013     1     1      554            600        -6      812            837
##  6  2013     1     1      554            558        -4      740            728
##  7  2013     1     1      555            600        -5      913            854
##  8  2013     1     1      557            600        -3      709            723
##  9  2013     1     1      557            600        -3      838            846
## 10  2013     1     1      558            600        -2      753            745
## # … with 336,766 more rows, and 11 more variables: arr_delay <dbl>,
## #   carrier <chr>, flight <int>, tailnum <chr>, origin <chr>, dest <chr>,
## #   air_time <dbl>, distance <dbl>, hour <dbl>, minute <dbl>, time_hour <dttm>

Exercises

  1. Find all flights that

    1. Had an arrival delay of two or more hours
    2. Flew to Houston (IAH or HOU)
    3. Were operated by United, American, or Delta
    4. Departed in summer (July, August, and September)
    5. Arrived more than two hours late, but didn’t leave late
    6. Were delayed by at least an hour, but made up over 30 minutes in flight
    7. Departed between midnight and 6am (inclusive)
  2. How many flights have a missing dep_time? What other variables are missing? What might these rows represent?

  3. How could you use arrange() to sort all missing values to the start? (Hint: use is.na()).

  4. Sort flights to find the most delayed flights. Find the flights that left earliest.

  5. Sort flights to find the fastest (highest speed) flights.

  6. Which flights travelled the farthest? Which travelled the shortest?

  7. What happens if you include the name of a variable multiple times in a select() call?

  8. Does the result of running the following code surprise you? How do the select helpers deal with case by default? How can you change that default?

    select(flights, contains("TIME"))
  9. Which carrier has the worst delays? Challenge: can you disentangle the effects of bad airports vs. bad carriers? Why/why not? (Hint: think about flights %>% group_by(carrier, dest) %>% summarise(n()))

Reading

If you have completed these exercises read through the complete chapter on data transformation in R4ds (chapter 5): https://r4ds.had.co.nz/transform.html (this will expand on many things covered in tthe video and exercises)